<div class="depot-form">
  <%= error_messages_for :entry  %>
  <fieldset>
    <legend>Enter Post Details</legend>
    <% form_tag({:action => "update"}, {:id => "entry_form"}) do %>
      <%= hidden_field :entry, :id %>
      <p>
        <label for="entry_title">Title:</label>
        <%= text_field :entry, :title, :size => 80, :maxlength => 255  %>
      </p>
    
      <p>
        <label for="entry_content">Content:</label>
        <%= fckeditor_textarea :entry, :content, :width => '88%', :height => '300px' %>
      </p>
    
      <p>
        <label for="entry_category">Category:</label>  
        <%= select :entry, :category, @categories.map {|item| [item.name, item.id ]} %>
      </p>
      <p>
        <label for="entry_tag_list">Tags:</label>
        <%= text_field :entry, :tag_list, :size => 80, :maxlength => 255  %>
        <div class="auto_complete" id="entry_tag_list_auto_complete"></div>
        <%= auto_complete_field :entry_tag_list, :url => {:action => :auto_complete_tag_list}, :tokens => ',' %>
      </p>
      <p>
        <%= submit_tag "Publish", :class => "submit", :disable_with => "Please wait..."%>
        <%= submit_to_remote("commit", "Update Draft", 
          {:class => "submit", :url => {:action => "update_draft"},
            :update => "draft_message", 
            :before => "var oEditor = FCKeditorAPI.GetInstance('entry_" + @entry.id.to_s + "_content_editor');oEditor.UpdateLinkedField()",
            :loading => 'Element.show("loading")', 
            :complete => 'Element.show("draft_message");Element.hide("loading")'}) %>
      </p>
    <% end %>
  </fieldset>
  <%= image_tag("ajax-loader.gif", :id => 'loading', :style => 'display:none') %>
  <div id="draft_message" style="display: none;"></div>
</div>
<%= update_fckeditor_linked_field(:entry, :content, 10) %>
<%= observe_form("entry_form", :url => {:action => :update_draft}, :update => "draft_message", 
  :frequency => 60, :loading => 'Element.show("loading")', 
  :complete => 'Element.show("draft_message");Element.hide("loading")') %> 
<%= render(:partial => 'categories', :object => @categories) %>